<template>
	<view>
		<canvas :style="{width:windowW+'px',height:'500px'}" canvas-id="firstCanvas" id="firstCanvas"></canvas>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				windowH: 0,
				windowW: 0,
				bottomH: 0,
				src: ''
			}
		},
		methods: {
			setImage(img) {
				const canvas = uni.createCanvasContext("firstCanvas", this)
				canvas.drawImage(img, 0, 0, 150, 100)
				canvas.draw()
			},
			getMechineStyle() {
				uni.getSystemInfo({
					success: (res) => {
						this.windowH = res.windowHeight
						this.windowW = res.windowWidth
						this.statusBarH = res.statusBarHeight
						this.bottomH = res.windowHeight - res.safeArea.bottom
					}
				})
			},
		},
		onLoad(e) {
			console.log(e)
			this.src = e.img
			this.getMechineStyle()
		},
		onShow() {
			this.setImage(this.src)
		}
	}
</script>

<style>

</style>